<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<script type="text/javascript">
	$(document).ready(function(){			
		$(":input[name=address]").change(function(){		
			//alert($("#searchForm").serialize());
			if($(this).val()==""){
				alert("주소를 선택하세요!");
				$("#showMember").empty();	
				return;
			}
			$.ajax({
				type:"post",
				url:"${initParam.root}member/findByAddressAjax.do",
				data:$("#searchForm").serialize(),
				dataType:"json", 
				success:function(jsonData){	
					$("#showMember").empty();											
					$.each(jsonData,function(index,mem){	
						//반복문 수행하면서 div resultView의 table 하위에 tr td 추가 
						$("#showMember").append(
								"<tr><td>"+mem.id+"</td><td>"+mem.name+"</td></tr>");						
					});					
				}//callback
			});//ajax
		});//change
	});//ready
</script>
<form id="searchForm">		
		<select name="address" onchange="searchGo()">
			<option value="">----</option>
			<c:forEach items="${requestScope.list }" var="str">
				<option value="${str}">${str}</option>
			</c:forEach>
		</select>
	</form>    
	<br><br><br><br>
	<table border=1>
	<thead><tr><th>아이디</th><th>이름</th></thead>
	<tbody id="showMember"></tbody>	
	</table>

